
close all;



%% pick plot
%     
    frequency_voltage_resistance_deadtime_Rg=[ 200 80 10 75 15 22 0];
%     frequency_voltage_current_deadtime=[200 60 4 5; ...
%                                         200 60 4 10; ...
%                                         200 60 3 15; ...
%                                         400 60 3 15; ...
%                                         400 60 3 10; ...
%                                         ];
[number_of_plots ~]=size(frequency_voltage_current_deadtime_Rg);
figure;
cc=hsv(number_of_plots);
marker={'x-'; 'o-';'^-';'*-';'s-'};
legendInfo={};

for i=1:number_of_plots
    file=sprintf('./data/3level_converter/3level2_%ikHz_%iV_%iOhms_duty%i_deadtime%i_Rg%i_%i.dat',frequency_voltage_resistance_deadtime_Rg(i,:))
    M = csvread(file,1,0);
    efficiency=M(:,6)./M(:,5);
    Ploss=M(:,5)-M(:,6);
    Iout=M(:,4);
    Vout=M(:,3);
    Pout=Vout.*Iout;
    plot(Pout,efficiency,marker{i},'color',cc(i,:),'LineWidth',0.75);
    hold all;
    legendInfo{i} = sprintf('%ikHz %iV %iA duty%i deadtime%i Rg%i,%i',frequency_voltage_current_deadtime_Rg(i,:));
end


%%
xlabel('Load current (A)');
ylabel('Power loss (W)');
legend(legendInfo,'Location','SouthEast');
grid on;
% ylim([65 100]);
% xlim([0 410]);

set(gcf, 'Position', [200 200 450 300])
set(gcf,'PaperPositionMode','auto')
% print('-depsc2', '../Paper/images/efficiency_unregulated_exp');
% matlab2tikz( '../Paper/images/efficiency_unregulated_exp.tikz',  'height', '\figureheight', 'width', '\figurewidth','showInfo', false);
